package com.itic.web.pay.config;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;


public class XmlUtil1 {
	
	/**
	 * xml转bean
	 * @return
	 */
	public  static Map<Object,Object> xmlToBean(String XML){
		Map<Object,Object> map =new HashMap<Object,Object>();
        try {
			Document document = DocumentHelper.parseText(XML);
			//获取根节点元素对象  
	        Element root = document.getRootElement(); 
	        Iterator<Element> iterator = root.elementIterator(); 
	        while(iterator.hasNext()){
	        	Element note = iterator.next();
	        	map.put(note.getName(), note.getStringValue());
	        }
	        
		} catch (DocumentException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}  
		
		return map;
		
	}
	
	

	

}
